package com.ylbh.modules.member.controller;

import java.util.Arrays;
import java.util.Map;

import com.ylbh.common.annotation.SysLog;
import com.ylbh.common.pojo.member.dto.select.RevenueLogSelectDTO;
import com.ylbh.common.utils.*;
import com.ylbh.common.pojo.member.dto.MemberPlayerDTO;
import com.ylbh.modules.member.service.MemberPlayerService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 *
 *这个类没用
 * @author mgh
 * @date 2019-04-17 10:30:39
 */
@RestController
@RequestMapping("member/player")
public class MemberPlayerController {
    @Autowired
    private MemberPlayerService memberPlayerService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("member:player:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = memberPlayerService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{playerId}")
    @RequiresPermissions("member:player:info")
    public R info(@PathVariable("playerId") String playerId){
		MemberPlayerDTO shoppingUserPlayer = memberPlayerService.getById(playerId);

        return R.ok().put("shoppingUserPlayer", shoppingUserPlayer);
    }

    /**
     * 保存
     */
    @SysLog("保存")
    @RequestMapping("/save")
    @RequiresPermissions("member:player:add")
    public R save(@RequestBody MemberPlayerDTO shoppingUserPlayer){
		memberPlayerService.save(shoppingUserPlayer);

        return R.ok();
    }

    /**
     * 修改
     */
    @SysLog("修改")
    @RequestMapping("/update")
    @RequiresPermissions("member:player:update")
    public R update(@RequestBody MemberPlayerDTO shoppingUserPlayer){
		memberPlayerService.updateById(shoppingUserPlayer);

        return R.ok();
    }

    /**
     * 删除
     */
    @SysLog("删除")
    @RequestMapping("/delete")
    @RequiresPermissions("member:player:delete")
    public R delete(@RequestBody String[] playerIds){
		memberPlayerService.removeByIds(Arrays.asList(playerIds));

        return R.ok();
    }
}
